<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
		<title>修改会员</title>
		<link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
		<link rel="stylesheet" href="/static/web/css/bootstrap.min.css">
		<link rel="stylesheet" href="/static/web/css/admin.css">
		<script src="/static/web/js/jquery.min.js"></script>
		<script src="/static/web/js/bootstrap.min.js"></script>
		<script src="/static/web/js/admin.main.js"></script>
	</head>
	<body>
		<form name="form2" action="member_do.php" method="post" onSubmit="return checkSubmit();">
			<input type="hidden" name="dopost" value="edituser">
			<input type="hidden" name="id" value="<?php echo $id?>">
			<table class="table shadow-sm my-3">
				<tr>
					<td colspan="2"><a href="<?php echo $ENV_GOBACK_URL;?>">会员管理</a> - 修改会员</td>
				</tr>
				<?php if ($row['matt']==10) echo '<tr><td colspan="2"><div class="alert alert-info mb-0">该会员关连网站管理员，修改不当会导致无法登录</div></td></tr>';?>
				<tr>
					<td colspan="2" align="center">
						<?php if ($row['face']!='') {echo "<p><img src='{$row['face']}' class='user-img-md'></p>";};echo "<p>".$row['userid']."</p>";?>
						<p class="m-0">
							<span class="btn btn-outline-success btn-sm"><?php echo GetMemberTypeName($row['rank']);?></span>
							<span class="btn btn-outline-warning btn-sm"><?php echo GetHonor($row['scores']);?></span>
						</p>
					</td>
				</tr>
				<tr>
					<td width="260">昵称：</td>
					<td><input type="text" name="uname" id="uname" class="admin-input-sm" value="<?php echo $row['uname']?>"></td>
				</tr>
				<tr>
					<td>密码：</td>
					<td>
						<input type="text" name="pwd" id="pwd" class="admin-input-sm">
						<span>（留空则不修改，请使用数字0-9小写a-z大写A-Z符号_@!.-）</span>
					</td>
				</tr>
				<tr>
					<td>邮箱：</td>
					<td><input type="text" name="email" id="email" autocomplete="off" class="admin-input-sm" value="<?php echo $row['email']?>"></td>
				</tr>
				<tr>
					<td>性别：</td>
					<td>
						<label><input type="radio" name="sex" value="男" <?php if ($row['sex']=='男') echo 'checked';?>> 男</label>
						<label><input type="radio" name="sex" value="女" <?php if ($row['sex']=='女') echo 'checked';?>> 女</label>
						<label><input type="radio" name="sex" <?php if ($row['sex']=='') echo 'checked';?>> 保密</label>
					</td>
				</tr>
				<tr>
					<td>钱包积分：</td>
					<td>
						<span>金币：<input type="text" name="money" id="money" class="admin-input-xs" value="<?php echo $row['money'];?>"></span>
						<span>积分：<input type="text" name="scores" id="scores" class="admin-input-xs" value="<?php echo $row['scores'];?>"></span>
						<span>余额：<input type="text" name="user_money" id="user_money" class="admin-input-xs" value="<?php echo $row['user_money'];?>"></span>
					</td>
				</tr>
				<tr>
					<td>等级：</td>
					<td>
						<?php
						$MemberTypes = array();
						$dsql->SetQuery("SELECT `rank`,membername FROM `#@__arcrank` WHERE `rank` > 0 ORDER BY `rank` ASC");
						$dsql->Execute('n');
						$MemberTypes[0] = "限制会员";
						while($nrow = $dsql->GetObject('n')){
							$MemberTypes[$nrow->rank] = $nrow->membername;
						}
						$options = "<select name='rank' class='admin-input-sm'>";
						foreach($MemberTypes as $k=>$v)
						{
							if ($k!=$row['rank']) $options .= "<option value='$k'>$v</option>";
							else $options .= "<option value='$k' selected>$v</option>";
						}
						$options .= "</select>";
						echo $options;
						?>
					</td>
				</tr>
				<tr>
					<td>升级时间：</td>
					<td>
						<input type="text" name="uptime" id="uptime" class="admin-input-sm" value="<?php echo $row['uptime']=($row['uptime']=='0')? GetDateTimeMk(time()) : GetDateTimeMk($row['uptime']);?>">
						<span>（如果您要升级会员，必须设置此时间为当前时间）</span>
					</td>
				</tr>
				<tr>
					<td>会员天数：</td>
					<td>
						<input type="text" name="exptime" id="exptime" class="admin-input-sm" value="<?php echo $row['exptime']?>">
						<span>（如果您要升级会员，会员天数必须大于0）</span>
					</td>
				</tr>
				<?php if ($mhasDay!=0) {$mhasDay=($mhasDay>0)? $mhasDay : '<tr><td colspan="2"><span class="text-danger">会员已经到期</span></td></tr>';?>
				<tr>
					<td>剩余天数：</td>
					<td><?php echo $mhasDay;?></td>
				</tr>
				<?php }?>
				<tr>
					<td>推荐级别：</td>
					<td>
						<input type="hidden" name="oldmatt" id="oldmatt" class="admin-input-sm" value="<?php echo $row['matt']?>">
						<input name="matt" type="text" id="matt" class="admin-input-sm" value="<?php echo $row['matt']?>">
						<span>（0普通、1推荐、10管理员）</span>
					</td>
				</tr>
				<tr>
					<td>投稿限制：</td>
					<td>
						<input type="text" name="send_max" class="admin-input-xs" value="<?php echo $row['send_max']?>">
						<span>（0不能投稿、-1无限次）</span>
					</td>
				</tr>
				<tr>
					<td>投稿剩余次数：</td>
					<td><?php echo $rtimes;?>次</td>
				</tr>
				<tr>
					<td>资料状况：</td>
					<td>
						<select name="spacesta" class="admin-input-sm">
							<?php
							foreach($staArr as $k=>$v)
							{
								if ($row['spacesta']==$k) echo "<option value='$k' selected>$v</option>";
								else echo "<option value='$k'>$v</option>";
							}
							?>
						</select>
					</td>
				</tr>
				<tr>
					<td>空间信息：</td>
					<td>
						<?php
						$nrow = $dsql->GetOne("SELECT * FROM `#@__member_tj` WHERE mid='{$row['mid']}'");
						echo "文档：{$nrow['article']} 图片：{$nrow['album']} 收藏：{$nrow['stow']} 浏览：{$nrow['pagecount']}";
						?>
					</td>
				</tr>
				<tr>
					<td>注册时间/地址：</td>
					<td>
						<span><?php echo GetDateTimeMk($row['jointime'])?></span>
						<span><?php echo $row['joinip']?></span>
					</td>
				</tr>
				<tr>
					<td>最近时间/地址：</td>
					<td>
						<span><?php echo GetDateTimeMk($row['logintime'])?></span>
						<span><?php echo $row['loginip']?></span>
					</td>
				</tr>
				<tr>
					<td>操作：</td>
					<td>
						<a href="member_do.php?dopost=memberlogin&id=<?php echo $row['mid'];?>&jumpurl=<?php echo $cfg_memberurl;?>/edit_baseinfo.php" target="_blank" class="btn btn-success btn-sm">修改资料</a>
						<a href="member_do.php?dopost=memberlogin&id=<?php echo $row['mid'];?>" target="_blank" class="btn btn-success btn-sm">会员面板</a>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<button type="submit" name="submit" class="btn btn-success btn-sm">保存</button>
						<button type="button" class="btn btn-outline-success btn-sm" onclick="location='member_main.php';">返回</button>
					</td>
				</tr>
			</table>
		</form>
		<script>
			function checkSubmit() {
				if (document.form2.email.value == "") {
					document.form2.email.focus();
					ShowMsg("邮箱不能为空");
					return false;
				}
				if (document.form2.uname.value == "") {
					document.form2.uname.focus();
					ShowMsg("会员昵称不能为空");
					return false;
				}
			}
		</script>
	</body>
</html>